<%--
	author:daniel.yan
	time:2012/4/29 14:19:26
--%>



<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib uri="TowkerTagLib" prefix="rbac"%>
<%@ taglib uri="/WEB-INF/tags/CommonFunction.tld" prefix="cfn" %> 
<%@include file="/commons/include/html_doctype.html"%>
<html>
<head>
<title>明细</title>
<%@include file="/commons/include/getById.jsp" %>
<script type="text/javascript">
$(function(){
	$('#printInfo').hide();
});
function printBill() {
	$('#printInfo').show();
	$('#mainInfo').hide();
	$(document.body).css('background-color', '#FFFFFF');
	this.print();
	$('#printInfo').hide();
	$('#mainInfo').show();
	$(document.body).css('background-color', '');
}
</script>
<style type="text/css">
#printInfo { display:block; line-height:25px; }
#mainPTable { border-top:1px solid #000000; border-left:1px solid #000000; }
#mainPTable td { border-bottom:1px solid #000000; border-right:1px solid #000000; padding:2px; }
</style>
</head>
<body>
<div id="mainInfo">
<table border="0" cellspacing="0" cellpadding="0" class="listLogo">
	<tr>
		<td class="title">送货单明细</td>
		<td>
			<div class="menuTool">
            	<a onClick="printBill()" class="send" href="javascript:void(0);">打印</a>
				<a class="back" onClick="javascript:window.history.back();return false;" href="#">返回</a>
			</div>
		</td>
	</tr>
</table>
<c:set var="goodsSize" value="${0}" />
<c:set var="sumMoney" value="${0}" />
<div class="line"></div>
<table border="0" cellspacing="1" cellpadding="0" class="listTable">
	<tr>
		<td class="form_title">送货单号：</td>
		<td class="form_input">${fn:escapeXml(po.delivery_sn)}</td>
	
		<td class="form_title">订单号：</td>
		<td class="form_input">${fn:escapeXml(po.order_code)}</td>
		
		<td class="form_title">制单日期：</td>
		<td class="form_input"><fmt:formatDate pattern="yyyy-MM-dd" value="${po.create_date}" /></td>
	</tr>
	<tr>
		<td class="form_title">客户代码：</td>
		<td class="form_input">${fn:escapeXml(po.custom_code)}</td>
		
	    <td class="form_title">客户名称：</td>
		<td class="form_input">${fn:escapeXml(po.customs_name)}</td>
		
		<td class="form_title">送货日期：</td>
		<td class="form_input"><fmt:formatDate pattern="yyyy-MM-dd" value="${po.delivery_date}" /></td>
	</tr>
	<tr>
		<td class="form_title">财务有效期：</td>
		<td class="form_input">${fn:escapeXml(po.acc_period)}</td>
		
		<td class="form_title">销售部门代码：</td>
		<td class="form_input">${fn:escapeXml(dep.dep_name)} ${fn:escapeXml(po.sell_dep_code)}</td>
	
		<td class="form_title">发货的仓库代码：</td>
		<td class="form_input">${fn:escapeXml(depot.depot_nane)} ${fn:escapeXml(po.depot_code)}</td>
	</tr>
	<tr>
		<td class="form_title">销售线路：</td>
		<td class="form_input">${fn:escapeXml(po.sell_line)}</td>
	
		<td class="form_title">制单员代码：</td>
		<td class="form_input">${fn:escapeXml(po.creater_code)}</td>
		
		<td class="form_title">状态：</td>
		<td class="form_input">${fn:escapeXml(cfn:getDeliveryStatusText(d.status))}</td>
	</tr>
	<tr>
		<td class="form_title">备注：</td>
		<td class="form_input"  colspan="5">${fn:escapeXml(po.remark)}</td>
	</tr>
    <tr>
	  <td class="form_title">产品报价</td>
	  <td class="form_input"  colspan="5"><table width="340" border="0" cellpadding="2" cellspacing="1" class="listLogo" id="MGoodsPanel">
	    <tr>
	      <td>产品代码</td>
	      <td>订购数量</td>
	      <td>产品价标</td>
	      <td>产品单价</td>
	      <td>产品金额</td>
        </tr>
	      <c:forEach items="${refGoods}" var="rg" varStatus="status">
	      <tr>
	      <td>${rg.goods_sn}</td>
	      <td>
          	${rg.amount}
          </td>
	      <td>
	      	${rg.discount}%
	      </td>
	      <td id="sprice_${rg.goods_id}">${rg.discount*rg.wprice/100}</td>
	      <td id="totalM_${rg.goods_id}">${rg.amount*rg.discount*rg.wprice/100}</td>
	      </tr>
          <c:set var="goodsSize" value="${goodsSize+1}" />
	      </c:forEach>
      </table></td>
    </tr>
</table>
</div>

<div id="printInfo">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="4" align="center">广州市五羊油漆股份有限公司</td>
    </tr>
    <tr>
      <td colspan="4" align="center">送货单</td>
    </tr>
    <tr>
      <td>版次/修订：B/0</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>文件编号</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>通知送货部门</td>
      <td>（客户编号：${po.custom_code}）</td>
      <td>日期：<fmt:formatDate pattern="yyyy-MM-dd" value="${po.create_date}" />（）</td>
      <td>NO.${po.delivery_sn}</td>
    </tr>
    <tr>
      <td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0" id="mainPTable">
        <tr>
          <td>客户</td>
          <td colspan="4">${po.customs_name}</td>
          <td>电话号码</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>地址</td>
          <td colspan="4">&nbsp;</td>
          <td>联系人</td>
          <td>&nbsp;</td>
          <td rowspan="2" valign="top" style="padding:4px;">送货人签名</td>
        </tr>
        <tr>
          <td>编号</td>
          <td>产品名称</td>
          <td>单位</td>
          <td>说明</td>
          <td>数量</td>
          <td>单价</td>
          <td>金额</td>
        </tr>
        <c:forEach items="${refGoods}" var="rg" varStatus="status">
          <tr>
            <td>${rg.goods_sn}</td>
            <td>${rg.goods_name}</td>
            <td>${rg.unit}</td>
            <td>&nbsp;</td>
            <td>${rg.amount}</td>
            <td>${rg.wprice}</td>
            <td>${rg.sumMoney}</td>
            <c:if test="${status.index == 0}">
              <td rowspan="${goodsSize/2 + 2}" valign="top" style="padding:4px;">收货人签名</td>
              </c:if>
            </tr>
            <c:set var="sumMoney" value="${rg.sumMoney+sumMoney}" />
        </c:forEach>
        <tr>
          <td>备注</td>
          <td colspan="4">${po.remark}</td>
          <td>金额合计</td>
          <td>${sumMoney }</td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>操作员：${fn:escapeXml(po.creater_code)}</td>
          <td>Tel：</td>
        </tr>
      </table></td>
    </tr>
  </table>
</div>
</body>
</html>
